import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { NoviceGiftBagInfo } from "./info/NoviceGiftBagInfo";
type int = number;
//class NoviceGiftBagConfig
    
    export  class NoviceGiftBagConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._levelArr = [];
            if (NoviceGiftBagConfig._instance != null) 
            {
                throw new Error("NoviceGiftBagConfig 单例");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_new_gift_bag_guild.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new NoviceGiftBagInfo();
                loc1.guildLevel = loc2.guildLevel;
                loc1.itemCode = loc2.itemCode;
                this._map[loc1.guildLevel] = loc1;
                this._levelArr.push(loc1.guildLevel);
            }
            this._levelArr.sort();
            return;
        }

        public getNoviceGiftBagInfoByLevel(arg1: int): NoviceGiftBagInfo
        {
            return this._map[arg1];
        }

        public getGuildLevels(): Array<any>
        {
            return this._levelArr;
        }

        public static get instance(): NoviceGiftBagConfig
        {
            if (NoviceGiftBagConfig._instance == null) 
            {
                NoviceGiftBagConfig._instance = new NoviceGiftBagConfig();
            }
            return NoviceGiftBagConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_levelArr: Array<any>;

        /* internal */ static /* var */_instance: NoviceGiftBagConfig;
    }
